using Share;
using UIElement;
using UnityEngine;
using UnityEngine.UI;


namespace WS.UI
{
    // ҡ��

    public class LogShow : PanelBase
    {
        [SerializeField]
        Button m_Close;
        [SerializeField]
        ScrollGrid m_ScrollGrid;
        protected override void Awake()
        {
            base.Awake();

        }
        ModifyBase m_Modify = new ModifyBase();
        // Start is called before the first frame update
        void Start()
        {
            m_Close.onClick.AddListener(() => DoClose());
            m_ScrollGrid.DoInit(XKLog.LogErrorCount(), OnScrollShow, OnScrollSelect);
            AddListener((int)SystemEventDef.System_LogError, OnLogError);
        }

        private bool OnLogError(int ge, EventParam parameter)
        {
            m_ScrollGrid.SetCount(XKLog.LogErrorCount());
            return true;
        }

        private void OnScrollSelect(CommonListItem item)
        {
            //item.gameObject.GetComponent<Text>().text = XKLog.LogErrorString(item.Value);
        }

        private void OnScrollShow(CommonListItem item)
        {
            item.gameObject.GetComponent<Text>().text = XKLog.LogErrorString(item.Value);
        }


        private void OnEnable()
        {
        }

    }
}
